import re  
import requests
from lxml import etree
import webbrowser
from concurrent.futures import ThreadPoolExecutor
from requests import get, head
import time,re
# 原始字符串  
text = "图片数量： 81张"  
  
# 使用正则表达式匹配数字  
match = re.search(r'\d+', text)  
  
if match:  
    number = match.group()  
    print(number)  # 输出：81  
else:  
    print("没有找到数字")

def geturl(url,path):
    # 获取源码
    html = requests.get(url)
    # html.encoding='gb2312'

    # 打印源码
    etree_html = etree.HTML(html.text)
    print(html.text)
    link = etree_html.xpath('{}/@src'.format(path))
    return link
if __name__ == '__main__':
    url='https://www.kunv.cc/tu/11065_4.html'
    xpath='//*[@id="showimg"]/center/a/img'
    a = geturl(url,xpath) 
    print(a)
    import requests  
  
    # 目标URL  
    url='https://www.kunv.cc/tu/11065_4.html' 
    
    # 发送GET请求  
    headers = {  
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3'}  
    response = requests.get(url, headers=headers) 
    # response = requests.get(url)  
    
    # 检查请求是否成功  
    if response.status_code == 200:  
        # 获取并打印网页内容  
        content = response.text  
        print(content)  
    else:  
        # 打印错误信息  
        print(f"请求失败，状态码：{response.status_code}")